package com.easyui.bean;

import java.util.List;
import java.util.Map;

import com.easyui.common.SelProject;
import com.easyui.common.SelTeacher;

public class Teacher {
	private String tno;
	private String tname;
	private String sex;
	private List<Map> ownProject;//自己发布的项目
	
	public Teacher(){};
	
	/**
	 * 通过参数初始化Teacher信息
	 * @param tno
	 * @param tname
	 * @param sex
	 */
	public Teacher(String tno, String tname, String sex) {
		if(tno != null && !tno.trim().equals("")) {
			this.tno = tno.trim();
		} else {
			this.tno = tno;
		}
		
		if(tname != null && !tname.trim().equals("")) {
			this.tname = tname.trim();
		} else {
			this.tname = tname;
		}
		
		if(sex != null && !sex.trim().equals("")) {
			if(sex.trim().equals("all")) {
				this.sex = "";
			} else {
				this.sex = sex.trim();
			}
		}
		
	}
	
	public void init(Map map) {
		String sex = (String)map.get("sex");
		
		/*if(sex.equals("female")) {
			this.sex = "女";
		} else {
			this.sex = "男";
		}*/
		
		this.setTno((String)map.get("tno"));
		this.setTname((String)map.get("tname"));
		this.setSex(sex);
		this.setOwnProject(new SelProject().getTProjects(this.getTno()));
	}
	
	public List<Map> getOwnProject() {
		return ownProject;
	}

	public void setOwnProject(List<Map> ownProject) {
		this.ownProject = ownProject;
	}
	
	public String getTno() {
		return tno;
	}
	public void setTno(String tno) {
		this.tno = tno;
	}
	public String getTname() {
		return tname;
	}
	public void setTname(String tname) {
		this.tname = tname;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
}
